/**
 *
 * @author Chris Fraser, Jean-Luc Richard
 * This class represents a card deck. A String[] deck will hold all
 * cards in the form of Strings.
 */
public class CardDeck {

   /**
    * A String array of cards in a deck
    */
   public String[] deck;
   
   /**
    * Constructor method
    */
   public CardDeck()
   {
     deck = new String[52];
     
     //Add ace cards
     deck[0] = "AC";
     deck[1] = "AD";
     deck[2] = "AS";
     deck[3] = "AH";
     
     //Add cards 2 through 10
     for(int i = 2; i < 11; i++)
     {
       deck[(i-1)*4] = i + "C";
       deck[(i-1)*4 + 1] = i + "D";
       deck[(i-1)*4 + 2] = i + "S";
       deck[(i-1)*4 + 3] = i + "H";
     }
     
     //Add face cards
     deck[40] = "JC";
     deck[41] = "JD";
     deck[42] = "JS";
     deck[43] = "JH";
     deck[44] = "QC";
     deck[45] = "QD";
     deck[46] = "QS";
     deck[47] = "QH";
     deck[48] = "KC";
     deck[49] = "KD";
     deck[50] = "KS";
     deck[51] = "KH"; 
   }
   
   /**
    * This method removes a set of cards from this deck
    * @param cards An array of cards in String form to remove this deck
    */
   public void removeCards(String[] cards)
   {
     //For every card in cards
     for(int i=0; i < cards.length; i++)
     { 
       //Search through deck
       for(int j=0; j < this.deck.length; j++)
       {
         if(this.deck[j].compareTo(cards[i]) == 0)
         {
           //Make new deck with one less element
           String[] newDeck = new String[this.deck.length - 1];
           
           //Fill first half of newDeck
           for(int k=0; k < j; k++)
           {
             newDeck[k] = this.deck[k];
           }
                
           for(int m=j; m < this.deck.length - 1; m++)
           {
             newDeck[m] = this.deck[m + 1];
           }
           this.deck = newDeck;
         }
       }
     }
     return;
   } //End removeCards()
}
